home *** CD-ROM | disk | FTP | other *** search
- Path: rain.fr!world-net!usenet
- From: dgklone@worldnet.net (Denis Glehen)
- Newsgroups: comp.lang.c++
- Subject: BorlandC - TIListImp class problem or misprogramming
- Date: Thu, 08 Feb 1996 23:11:30 GMT
- Organization: sct.fr
- Message-ID: <4fe0lk$cu3@aldebaran.sct.fr>
- NNTP-Posting-Host: client22.sct.fr
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hi all,
-
- i've a little problem with the use of TListImp and LIListImp class
- function.
-
- I would like create a list with some data on it. I saw that Borland
- purpose a class as it => TListImp class.
-
- But, I don't find how make it working.
-
- I've a private class Noeud wich contain in X and int Y.
- I create constructor and destructor and two small function. Ninit and
- Nprint.
-
- I want create node Noeud (dynamically) and attach them to the list.
- So, i use TIListImp wich seem working with pointer :
-
- class Noeud {
- private:
- int x;
- int y;
- public:
- Noeud(void);
- ~Noeud(void);
- void Ninit(int a,int b);
- void Nprint(void);
- };
-
-
- void printN(Noeud *nn)
- {
- nn->Nprint();
- }
-
- // Main function
- --------------------------------------------------------------
- int OwlMain(int,char **)
- {
- PROGRAM Testing("Test"); // define previously, testing it ok !
- TIListImp <Noeud> listNoeud;
-
- Noeud *nnA=NULL; // create first node
- Noeud *nnB=NULL; // create second node
-
- nnA = new Noeud();
- nnB = new Noeud();
-
- nnA->Ninit(1,2); // init nodes
- nnB->Ninit(2,4);
-
- listNoeud.Add(nnA); // add node to list
- listNoeud.Add(nnB);
-
-
- // want to print them !! ???? error on compilation
-
- listNoeud.ForEach(printN);
-
-
- delete nnB;
- delete nnA;
-
- return Testing.Run();
- }
-
-
-
- // PROGRAM class
- --------------------------------------------------------------
- PROGRAM::PROGRAM(const char far *name) : TApplication(name)
- {
- }
-
- PROGRAM::~PROGRAM(void)
- {
- }
-
-
- // Noeud class
- ----------------------------------------------------------------
- Noeud::Noeud(void)
- {
- }
-
- Noeud::~Noeud(void)
- {
- }
-
- void Noeud::Ninit(int a,int b)
- {
- x = a;
- y = b;
- }
-
- void Noeud::Nprint(void)
- {
- cout << "X=" << x << " Y=" << y;
- }
-
- The question is how TIListImp work, I didn't find any docs on it, just
- the BorlandC help and it's very small.
-
- Is it the good class (TListImp) I must use or is it another class (as
- TListImp).
-
- And finally, why doesn't it work ? And what mus I do ?
-
- Thanks for answering by email at dgklone@worldnet.net
-
- Bye - Denis
- --
- Have a good day
- Klone Development - Denis Glehen - France
- Tel : (33) 98 49 07 12 Fax : (33) 98 49 09 41
- Email : dgklone@world-net.sct.fr :-)
-
-